<script setup>
import { ref, onMounted } from 'vue'
import easyapi from '../api'
import { ElMessage, ElMessageBox, pageHeaderEmits } from 'element-plus'
//定义绑定的数据
const tableData = ref([]);
//控制新增信息窗口是否显示
const addWinVisible = ref(false);
//新增数据绑定对象
const addObject = ref({});
//控制新增信息窗口是否显示
const editWinVisible = ref(false);
//编辑数据绑定对象
const editObject = ref({});
//记录编辑数据的下标
var editIndex = -1;
//分页的总页数
const total = ref(100)
//查询数据输入框的绑定对象
const checkObj = ref({
    size: 7,
    page: 1
})

//类型
const types = ref([])
//状态
const status = ref([])
//私教课程列表
const courseTypes = ref([])
//公共课程列表
const publicCourses = ref([])

const cascaderProps = {
    // 配置 emitPath 为 false，使得选中的值不是数组而是具体值  
    emitPath: false,
    value: 'value',
    label: 'label',
    children: 'children'
}


onMounted(async function () {
    //获取会员卡类型分类
    let result = await easyapi.get('/api/membertype')
    types.value = result.data
    //获取会员状态分类
    result = await easyapi.get('/api/memberstatustype')
    status.value = result.data
    //获取私教课程列表
    result = await easyapi.getSearch('/api/private', { size: 100, page: 1 })
    if (result.data.list) {
        for (let i = 0; i < result.data.list.length; i++) {
            // 使用 push 方法向 types 数组添加新对象  
            courseTypes.value.push({
                label: result.data.list[i].name + "---" + result.data.list[i].trainerName,
                value: result.data.list[i].id
            });
        }
    }
    //获取公共课列表
    result = await easyapi.getSearch('/api/public', { size: 100, page: 1 })
    console.log(result.data.list)
    if (result.data.list) {
        for (let i = 0; i < result.data.list.length; i++) {
            // 使用 push 方法向 types 数组添加新对象  
            publicCourses.value.push({
                label: result.data.list[i].name + "---" + result.data.list[i].trainerName + "---" + result.data.list[i].date,
                value: result.data.list[i].id
            });
        }
    }
    checkData();
})

//删除数据
const del = function (index, row) {
    ElMessageBox.confirm(
        '确认删除该行数据吗?',
        '警告',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
        }
    )
        .then(async () => {
            //提交数据
            let result = await easyapi.del('/api/member', row.memberID)
            if (result.code == 200) {
                //刷新表单数据
                tableData.value.splice(index, 1)
                if (tableData.value.length == 0) {
                    checkObj.value.page = (checkObj.value.page - 1) < 1 ? 1 : checkObj.value.page - 1;
                    checkData(checkObj.value.page)
                } else {
                    checkData();
                }
                //提示删除成功
                ElMessage({
                    type: 'success',
                    message: '删除成功',
                })
            } else {
                ElMessage({
                    type: 'error',
                    message: result.message,
                })
            }

        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消删除',
            })
        })
}

//新增数据
//显示新增窗口
const openAddWin = async function () {
    addObject.value = {}
    imageUrl.value = 'api' + '/img/default.png'
    addWinVisible.value = true;
}
//关闭新增窗口
const closeAddWin = function () {
    addWinVisible.value = false;
}
const imageUrl = ref({})

const handleAvatarSuccess = (response, uploadfile) => {
    imageUrl.value = 'api' + response.data
    addObject.value.imgUrl = response.data
    editObject.value.imgUrl = response.data
}

//上传新增数据
const addSave = async function () {
    //保存新增的数据 addObject
    //发送请求
    addForm.value.validate(async (valid) => {
        if (valid) {
            let result = await easyapi.postJson('/api/member', addObject.value);
            if (result.code == 200) {
                //当前页行数小于size则将数据添加到该页
                if (tableData.value.length < checkObj.value.size) {
                    tableData.value.push(result.data);
                } else {
                    checkData();
                }
                //刷新表单
                //提示新增成功
                ElMessage({
                    type: 'success',
                    message: '新增数据成功',
                })
                //关闭窗口
                closeAddWin()
            } else {
                ElMessage({
                    type: 'info',
                    message: result.message,
                })
            }

        } else {
            ElMessage({
                type: 'info',
                message: '格式错误',
            })
        }
    })
}

//修改数据
//显示编辑窗口
const openEditWin = function () {
    editWinVisible.value = true;
}
//关闭编辑窗口
const closeEditWin = function () {
    editWinVisible.value = false;
}
//点击编辑按钮，执行的方法
const edit = function (index, row) {
    //绑定要修改的数据
    editObject.value.memberID = row.memberID;
    imageUrl.value = 'api' + row.imgUrl
    editObject.value.imgUrl = row.imgUrl
    editObject.value.name = row.name;
    editObject.value.phoneNumber = row.phoneNumber;
    editObject.value.email = row.email;
    editObject.value.nationalIDNumber = row.nationalIDNumber;
    editObject.value.membershipType = row.membershipType;
    editObject.value.startDate = row.startDate;
    editObject.value.endDate = row.endDate;
    editObject.value.status = row.status;
    editIndex = index;
    //打开对话框
    openEditWin();
}
//保存修改编辑数据
const editSave = async () => {
    editForm.value.validate(async (valid) => {
        if (valid) {
            //发送请求
            let result = await easyapi.putJson('/api/member', editObject.value)
            if (result.code == 200) {
                //刷新表单
                tableData.value[editIndex] = result.data;
                //提示
                ElMessage({
                    type: 'success',
                    message: '编辑数据成功',
                })
                //关闭窗口
                closeEditWin()
            } else {
                ElMessage({
                    type: 'info',
                    message: result.message,
                })
            }
        } else {
            ElMessage({
                type: 'info',
                message: '格式错误',
            })
        }
    })
}

//查询功能
const checkData = async (val) => {
    //获取当前页数
    if (typeof val == 'number') {
        checkObj.value.page = val;
    }
    //查询数据
    let result = await easyapi.getSearch('/api/member', checkObj.value)
    //更新表格中的数据
    tableData.value = result.data.list;
    total.value = result.data.count;
}

const getFullImageUrl = (relativeUrl) => {

    return `/api${relativeUrl}`;
}



//表单验证
const addForm = ref({})

const checkName = (rule, value, callback) => {
    if (addObject.value.name) {
        callback();
    } else {
        callback(new Error('姓名不能为空'))
    }
}

const checkPhoneNumber = (rule, value, callback) => {
    let regex = /^1[3-9]\d{9}$/
    if (regex.test(addObject.value.phoneNumber)) {
        callback();
    } else {
        callback(new Error('手机号码不正确'))
    }
}

const checkEmail = (rule, value, callback) => {
    let regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
    if (regex.test(addObject.value.email)) {
        callback();
    } else {
        callback(new Error('邮箱格式不正确'))
    }
}

const checkNationalIDNumber = (rule, value, callback) => {
    let regex = /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/
    if (regex.test(addObject.value.nationalIDNumber)) {
        callback();
    } else {
        callback(new Error('身份证格式不正确'))
    }
}

const checkStartDate = (rule, value, callback) => {
    let regex = /^\d{4}-\d{2}-\d{2}$/
    if (regex.test(addObject.value.startDate)) {
        callback();
    } else {
        callback(new Error('日期格式不正确'))
    }
}

const checkEndDate = (rule, value, callback) => {
    let regex = /^\d{4}-\d{2}-\d{2}$/
    if (regex.test(addObject.value.endDate) && (addObject.value.endDate > addObject.value.startDate)) {
        callback();
    } else {
        callback(new Error('日期格式不正确或结束日期早于开始日期'))
    }
}

const checkMembershipType = (rule, value, callback) => {
    if (addObject.value.membershipType) {
        callback();
    } else {
        callback(new Error('不能为空'))
    }
}

const checkStatus = (rule, value, callback) => {
    if (addObject.value.status) {
        callback();
    } else {
        callback(new Error('不能为空'))
    }
}

const addCheckRules = {
    name: [{ validator: checkName, trigger: 'blur' }],
    phoneNumber: [{ validator: checkPhoneNumber, trigger: 'blur' }],
    email: [{ validator: checkEmail, trigger: 'blur' }],
    nationalIDNumber: [{ validator: checkNationalIDNumber, trigger: 'blur' }],
    startDate: [{ validator: checkStartDate, trigger: 'blur' }],
    endDate: [{ validator: checkEndDate, trigger: 'blur' }],
    membershipType: [{ validator: checkMembershipType, trigger: 'blur' }],
    status: [{ validator: checkStatus, trigger: 'blur' }],
};

const editForm = ref({})

const editCheckRules = {
    name: [
        { required: true, message: '请输入姓名', trigger: 'blur' },
    ],
    phoneNumber: [
        { required: true, message: '请输入电话号码', trigger: 'blur' },
        { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
    ],
    email: [
        { required: true, message: '请输入电子邮箱', trigger: 'blur' },
        { type: 'email', message: '请输入正确的电子邮箱地址', trigger: ['blur', 'change'] }
    ],
    nationalIDNumber: [
        { required: true, message: '请输入身份证号', trigger: 'blur' },
        { pattern: /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/, message: '请输入正确的身份证号', trigger: 'blur' }
    ],
    startDate: [
        { required: true, message: '请输入开始时间', trigger: 'blur' },
        { pattern: /^\d{4}-\d{2}-\d{2}$/, message: '请选择正确的开始日期', trigger: 'blur' }
    ],
    endDate: [
        {
            validator: (rule, value, callback) => {
                let regex = /^\d{4}-\d{2}-\d{2}$/
                console.log(editObject.value.endDate)
                console.log(editObject.value.startDate)
                if (regex.test(editObject.value.endDate) && (editObject.value.endDate > editObject.value.startDate)) {
                    callback();
                } else {
                    callback(new Error('结束日期早于开始日期'))
                }
            }, trigger: 'blur'
        }
    ]
}

// 买课
const buyWinVisible = ref(false)
const buyObject = ref({})
const buyForm = ref({})
const buyData = ref([])

const openBuyWin = function () {
    buyWinVisible.value = true;
}
//关闭买课窗口
const closeBuyWin = function () {
    buyWinVisible.value = false;
}

const buy = async function (index, row) {
    buyObject.value = {}
    buyObject.value.memberID = row.memberID
    //查询数据
    let result = await easyapi.getByID('/api/memberbuy', row.memberID)
    //更新表格中的数据
    buyData.value = result.data;
    openBuyWin();
}

//时间格式函数
const formatDate = (date) => {
    let year = date.getFullYear();
    let month = String(date.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的  
    let day = String(date.getDate()).padStart(2, '0');
    let hours = String(date.getHours()).padStart(2, '0');
    let minutes = String(date.getMinutes()).padStart(2, '0');
    let seconds = String(date.getSeconds()).padStart(2, '0');
    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}

//保存买课数据
const buySave = async () => {
    buyForm.value.validate(async (valid) => {
        if (valid) {
            //发送请求
            let now = new Date();
            let dateString = formatDate(now);
            buyObject.value.time = dateString
            await easyapi.postJson('/api/order', buyObject.value)
            //提示
            ElMessage({
                type: 'success',
                message: '买课成功',
            })
            //关闭窗口
            closeBuyWin()
        } else {
            ElMessage({
                type: 'info',
                message: '格式错误',
            })
        }
    })
}

const buyCheckRules = {
    courseID: [
        { required: true, message: '请选择课程', trigger: 'blur' },
    ],
    total: [
        { required: true, message: '请输入总课时', trigger: 'blur' },
        {
            validator: (rule, value, callback) => {
                // 使用正则表达式检查是否为正整数  
                if (!/^\d+$/.test(value)) {
                    // 如果不是正整数，返回错误  
                    callback(new Error('总课时必须是正整数'));
                } else {
                    // 转换为数字进行比较  
                    const numValue = Number(value);
                    if (numValue < 1 || numValue > 50) {
                        // 如果数字不在1到50之间，返回错误  
                        callback(new Error('总课时必须在1到50之间'));
                    } else {
                        // 验证通过  
                        callback();
                    }
                }
            }, trigger: 'blur'
        }
    ],
    payment: [
        { required: true, message: '请填入支付金额', trigger: 'blur' },
        // 使用正则表达式验证小数点后两位  
        { pattern: /^\d+(\.\d{1,2})?$/, message: '价格必须为两位小数', trigger: 'blur' }
    ]
}

//预约公共课
const bookWinVisible = ref(false)
const bookObject = ref({})
const bookForm = ref({})
const bookData = ref([])

const openBookWin = function () {
    bookWinVisible.value = true;
}

const closeBookWin = function () {
    bookWinVisible.value = false;
}

const book = async function (index, row) {
    bookObject.value = {}
    bookObject.value.memberID = row.memberID
    //查询数据
    let result = await easyapi.getByID('/api/book', row.memberID)
    //更新表格中的数据
    bookData.value = result.data;
    //打开对话框
    openBookWin();
}



const bookSave = async () => {
    bookForm.value.validate(async (valid) => {
        if (valid) {
            //发送请求
            let result = await easyapi.postJson('/api/book', bookObject.value)
            if (result.code == 200) {
                //提示
                ElMessage({
                    type: 'success',
                    message: '买课成功',
                })
                //关闭窗口
                closeBookWin()
            } else {
                ElMessage({
                    type: 'info',
                    message: result.message,
                })
            }

        } else {
            ElMessage({
                type: 'info',
                message: '格式错误',
            })
        }
    })
}

const bookCheckRules = {
    courseID: [
        { required: true, message: '请选择课程', trigger: 'blur' },
    ]
}

const cancel = function (index, row) {
    ElMessageBox.confirm(
        '确认取消预定吗?',
        '提示',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
        }
    )
        .then(async () => {
            //提交数据
            await easyapi.del('/api/book', row.id)
            //刷新表单数据
            bookData.value.splice(index, 1)
            //提示删除成功
            ElMessage({
                type: 'success',
                message: '取消成功',
            })
        })
}
</script>
<template>
    <el-input v-model="checkObj.name" style="width: 150px" placeholder="请输入查询的姓名" />
    <el-input v-model="checkObj.phoneNumber" style="width: 150px" placeholder="请输入查询的手机号" />
    <el-button type="primary" @click="checkData">查询</el-button>
    <el-button type="primary" @click="openAddWin">新增</el-button>
    <el-table :data="tableData" :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
        style="width: 100%">
        <el-table-column prop="imgUrl" label="头像" width="60px">
            <template v-slot="scope">
                <img :src="getFullImageUrl(scope.row.imgUrl)" style="width: 50px; height: 50px; object-fit: cover;">
            </template>
        </el-table-column>
        <el-table-column prop="name" label="姓名" />
        <el-table-column prop="phoneNumber" label="电话号码" width="115px" />
        <el-table-column prop="email" label="电子邮箱" width="200px" />
        <el-table-column prop="nationalIDNumber" label="身份证号" width="200px" />
        <el-table-column prop="membershipType" label="类型" />
        <el-table-column prop="startDate" label="开始日期" width="105px" />
        <el-table-column prop="endDate" label="结束日期" width="105px" />
        <el-table-column prop="status" label="状态" />
        <el-table-column label="操作" width="280px" header-align="center">
            <template #default="scope">
                <el-button type="primary" size="small" :disabled="scope.row.status !== '启用'" @click="buy(scope.$index, scope.row)">买课</el-button>  
            <el-button type="primary" size="small" :disabled="scope.row.status !== '启用'" @click="book(scope.$index, scope.row)">预约</el-button>
                <el-button type="success" size="small" @click="edit(scope.$index, scope.row)">编辑</el-button>
                <el-button type="danger" size="small" @click="del(scope.$index, scope.row)">删除</el-button>
            </template>
        </el-table-column>
    </el-table>
    <!-- 分页组件初始显示的页码 -->
    <!-- size:每页的条数 -->
    <el-pagination :page-size="checkObj.size" :current-page="checkObj.page" background layout="prev, pager, next"
        :total="total" @current-change="checkData" />


    <!--start 新增信息的弹出框 -->
    <el-dialog v-model="addWinVisible" title="新增会员数据" width="500">
        <el-form :model="addObject" :rules="addCheckRules" ref="addForm">
            <el-form-item label="头像" :label-width="80" prop="imgUrl">
                <el-upload class="avatar-uploader" action="api/img" :show-file-list="false"
                    :on-success="handleAvatarSuccess">
                    <img v-if="imageUrl" :src="imageUrl" class="avatar" />
                    <el-icon v-else class="avatar-uploader-icon">
                        <Plus />
                    </el-icon>
                </el-upload>
            </el-form-item>
            <el-form-item label="姓名" :label-width="80" prop="name">
                <el-input v-model="addObject.name" autocomplete="off" />
            </el-form-item>
            <el-form-item label="电话号码" :label-width="80" prop="phoneNumber">
                <el-input v-model="addObject.phoneNumber" autocomplete="off" />
            </el-form-item>
            <el-form-item label="电子邮箱" :label-width="80" prop="email">
                <el-input v-model="addObject.email" autocomplete="off" />
            </el-form-item>
            <el-form-item label="身份证号" :label-width="80" prop="nationalIDNumber">
                <el-input v-model="addObject.nationalIDNumber" autocomplete="off" />
            </el-form-item>
            <el-form-item label="开始日期" :label-width="80" prop="startDate">
                <el-date-picker format="YYYY/MM/DD" value-format="YYYY-MM-DD" v-model="addObject.startDate" type="date"
                    placeholder="开始日期" :size="size" />
            </el-form-item>
            <el-form-item label="结束日期" :label-width="80" prop="endDate">
                <el-date-picker format="YYYY/MM/DD" value-format="YYYY-MM-DD" v-model="addObject.endDate" type="date"
                    placeholder="结束日期" :size="size" />
            </el-form-item>
            <el-form-item label="类型" :label-width="80" prop="membershipType">
                <el-cascader :props="cascaderProps" v-model="addObject.membershipType" :options="types" />
            </el-form-item>
            <el-form-item label="状态" :label-width="80" prop="status">
                <el-cascader :props="cascaderProps" v-model="addObject.status" :options="status" />
            </el-form-item>
        </el-form>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="closeAddWin">取消</el-button>
                <el-button type="primary" @click="addSave">
                    确认
                </el-button>
            </div>
        </template>
    </el-dialog>
    <!--end 新增信息的弹出框 -->

    <!--start 修改信息的弹出框 -->
    <el-dialog v-model="editWinVisible" title="修改会员数据" width="500">
        <el-form :model="editObject" :rules="editCheckRules" ref="editForm">
            <el-form-item label="头像" :label-width="80" prop="imgUrl">
                <el-upload class="avatar-uploader" action="api/img" :show-file-list="false"
                    :on-success="handleAvatarSuccess">
                    <img v-if="imageUrl" :src="imageUrl" class="avatar" />
                    <el-icon v-else class="avatar-uploader-icon">
                        <Plus />
                    </el-icon>
                </el-upload>
            </el-form-item>
            <el-form-item label="姓名" :label-width="80" prop="name">
                <el-input v-model="editObject.name" autocomplete="off" />
            </el-form-item>
            <el-form-item label="电话号码" :label-width="80" prop="phoneNumber">
                <el-input v-model="editObject.phoneNumber" autocomplete="off" />
            </el-form-item>
            <el-form-item label="电子邮箱" :label-width="80" prop="email">
                <el-input v-model="editObject.email" autocomplete="off" />
            </el-form-item>
            <el-form-item label="身份证号" :label-width="80" prop="nationalIDNumber">
                <el-input v-model="editObject.nationalIDNumber" autocomplete="off" />
            </el-form-item>
            <el-form-item label="开始日期" :label-width="80" prop="startDate">
                <el-date-picker format="YYYY/MM/DD" value-format="YYYY-MM-DD" v-model="editObject.startDate" type="date"
                    placeholder="开始日期" :size="size" />
            </el-form-item>
            <el-form-item label="结束日期" :label-width="80" prop="endDate">
                <el-date-picker format="YYYY/MM/DD" value-format="YYYY-MM-DD" v-model="editObject.endDate" type="date"
                    placeholder="结束日期" :size="size" />
            </el-form-item>
            <el-form-item label="类型" :label-width="80" prop="membershipType">
                <el-cascader :props="cascaderProps" v-model="editObject.membershipType" :options="types" />
            </el-form-item>
            <el-form-item label="状态" :label-width="80" prop="status">
                <el-cascader :props="cascaderProps" v-model="editObject.status" :options="status" />
            </el-form-item>
        </el-form>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="closeEditWin">取消</el-button>
                <el-button type="primary" @click="editSave">
                    确认
                </el-button>
            </div>
        </template>
    </el-dialog>
    <!--end 修改信息的弹出框 -->

    <!--start 购买课程的弹出框 -->
    <el-dialog v-model="buyWinVisible" title="会员买课" width="500">
        <el-form :model="buyObject" :rules="buyCheckRules" ref="buyForm">
            <el-form-item label="选择课程" :label-width="80" prop="courseID">
                <el-cascader :props="cascaderProps" v-model="buyObject.courseID" :options="courseTypes" />
            </el-form-item>
            <el-form-item label="总课时" :label-width="80" prop="total">
                <el-input v-model="buyObject.total" autocomplete="off" />
            </el-form-item>
            <el-form-item label="支付金额" :label-width="80" prop="payment">
                <el-input v-model="buyObject.payment" autocomplete="off" />
            </el-form-item>
        </el-form>
        <el-table :data="buyData" :header-cell-style="{ 'text-align': 'center' }"
            :cell-style="{ 'text-align': 'center' }" style="width: 100%">
            <el-table-column prop="courseName" label="课程名" />
            <el-table-column prop="trainerName" label="课程教练" />
            <el-table-column prop="total" label="总课时" />
            <el-table-column prop="completed" label="完成课时" />
        </el-table>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="closeBuyWin">取消</el-button>
                <el-button type="primary" @click="buySave">
                    确认
                </el-button>
            </div>
        </template>
    </el-dialog>
    <!--end 购买课程的弹出框 -->

    <!--start 预约的弹出框 -->
    <el-dialog v-model="bookWinVisible" title="会员预约" width="1000">
        <el-form :model="bookObject" :rules="bookCheckRules" ref="bookForm">
            <el-form-item label="选择公共课" :label-width="100" prop="courseID">
                <el-cascader :props="cascaderProps" v-model="bookObject.courseID" :options="publicCourses"
                    style="width: 400px;" />
            </el-form-item>
        </el-form>
        <el-table :data="bookData" :header-cell-style="{ 'text-align': 'center' }"
            :cell-style="{ 'text-align': 'center' }" style="width: 100%">
            <el-table-column prop="courseName" label="课程名" />
            <el-table-column prop="trainerName" label="课程教练" />
            <el-table-column prop="date" label="时间" />
            <el-table-column prop="address" label="地点" />
            <el-table-column label="操作" header-align="center">
                <template #default="scope">
                    <el-button type="danger" size="small" @click="cancel(scope.$index, scope.row)">取消预定</el-button>
                </template>
            </el-table-column>
        </el-table>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="closeBookWin">取消</el-button>
                <el-button type="primary" @click="bookSave">
                    确认
                </el-button>
            </div>
        </template>
    </el-dialog>
    <!--end 预约的弹出框 -->
</template>


<style scoped>
.avatar-uploader .avatar {
    width: 178px;
    height: 178px;
    display: block;
}
</style>

<style>
.avatar-uploader .el-upload {
    border: 1px dashed var(--el-border-color);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--el-transition-duration-fast);
}

.avatar-uploader .el-upload:hover {
    border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    text-align: center;
}
</style>